import type { TableColumn } from '@/framework/components/core/super-table';
import dayjs from 'dayjs';
import { i18n } from '@/locales';

export type TableListItem = {
  id;
  type;
  originalSerial;
  name;
  projectName;
  serial;
  epc;
  sampleTime;
  sampleAddress;
  capacity;
  preservUserName;
  storageDesp;
  originalStorageDesp;
};
export type TableColumnItem = TableColumn<TableListItem>;

export const baseColumns: TableColumnItem[] = [
  {
    type: 'seq',
    title: '序号',
    width: 60,
  },
  {
    // @ts-ignore
    title: i18n.global.t('specimen.original_serial'),
    field: 'originalSerial',
  },
  {
    // @ts-ignore
    title: i18n.global.t('specimen.name'),
    field: 'name',
  },
  {
    title: '序列号',
    field: 'serial',
  },
  {
    // @ts-ignore
    title: i18n.global.t('specimen.epc'),
    field: 'epc',
  },
  {
    // @ts-ignore
    title: `${i18n.global.t('specimen.topic')}组`,
    field: 'projectName',
  },
  {
    title: '采样日期',
    field: 'sampleTime',
    formatter: ({ cellValue }) => {
      return cellValue ? dayjs(cellValue).format('YYYY-MM-DD') : '-';
    },
  },
  {
    title: '采样地点',
    field: 'sampleAddress',
  },
  {
    title: '容量(ml)',
    field: 'capacity',
  },
  {
    // @ts-ignore
    title: '移库前位置',
    field: 'originalStorageDesp',
  },
  {
    title: '移库后位置',
    field: 'storageDesp',
  },
];
